package cn.zyq.stater.config3.autoproperties;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Component;

@Component
//@Value反射赋值的,没有set方法也可以, @ConfigurationProperties是使用的setter方法,并提供多级属性赋值
@ConfigurationProperties(prefix = "zyq")//用来读取一个properties配置文件
@EnableConfigurationProperties
/**
 * 当前程序启动,JDBCPropertyData一旦被扫描,
 * 由于属性读取注解生效,会自动读取 properties文件中的如下信息
 * zyq.name
 * zyq.password
 * zyq.driverClassName
 */
public class JDBCPropertyData {

    private String name;
    private String password;
    private String driverClassName;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getDriverClassName() {
        return driverClassName;
    }

    public void setDriverClassName(String driverClassName) {
        this.driverClassName = driverClassName;
    }
}